<extend name="Public/base" />

<block name="style" >
    <style>
        .row{
            overflow-y: hidden;
        }
        .user_table{
            border: 1px solid #ddd;
            width: 180px;
        }
        .user_table tr{
            border: 1px solid #dddddd;
            height: 30px;
        }
        .user_table td{
            border: 1px solid #dddddd;
            width: 90px;
            text-align: center;
        }
    </style>
</block>

<block name="body">
    <!-- 弹窗插件 -->
    <include file="Public:artdialog" />
    <!-- 表单验证插件 -->
    <include file="Public:validform" />

    <form action="{:U('set_vip')}" method="post" role="form" class="form-horizontal row-border vform" >

        <input type="hidden" name="id" value="{$entity['id']}">
        <input type="hidden" name="is_add" value="{$is_add}">

        <div class="row">
            <div class="col-md-12">
                <div class="block-web">
                    <div class="header">
                        <h3 class="content-header">开设/取消VIP</h3>
                    </div>
                    <div class="porlets-content">
                        <table style="width: 100%;    table-layout: fixed;">
                            <tr>
                                <td width="40%" style="vertical-align:top;">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"><font class="red">*</font>用户账户</label>
                                        <div class="col-sm-6">
                                            <input type="text" value="" name="user_name" readonly id="user_name" class="form-control " />
                                            <div class="Validform_checktip"></div>
                                        </div>
                                    </div>

                                    <div class="form-group" id="user_info" style="display: none;">
                                        <label class="col-sm-3 control-label"></label>
                                        <div class="col-sm-6">
                                            <table class="user_table">
                                                <tr>
                                                    <td>用户昵称</td>
                                                    <td id="nickname">-</td>
                                                </tr>
                                                <tr>
                                                    <td>手机号码</td>
                                                    <td id="mobile_phone">-</td>
                                                </tr>
                                                <tr>
                                                    <td>余额</td>
                                                    <td id="user_money">-</td>
                                                </tr>
                                                <tr>
                                                    <td class='red'>是否为VIP</td>
                                                    <td id="is_vip"  class='red'>-</td>
                                                </tr>
                                            </table>
                                        </div>
                                        <input type="hidden" name="is_vip" id="vip" value=""/>
                                        <input type="hidden" name="mobile" id="mobile" value=""/>
                                        <input type="hidden" name="user_id" id="user_id" value="{:I('user_id')}"/>
                                    </div>


                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">备注</label>
                                        <div class="col-sm-8">
                                            <textarea  class="form-control" style="height:80px;" name="remark"></textarea>
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"></label>
                                        <button class="btn btn-primary btn-success bt_submit" type="submit" id="submit">开设VIP</button>
                                    </div>

                                </td>
                                <td width="58%" style="margin-left: 2%;vertical-align: top;">
                                    <table class="table table-bordered" id="tbmain">
                                        <thead>
                                        <tr>
                                            <th width='100'>操作人</th>
                                            <th width='150'>操作时间</th>
                                            <th>操作备注</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <notempty name="_datalist['lists']">
                                            <volist name="_datalist['lists']" id="vo">
                                                <tr>
                                                    <td>{$vo['admin_user_name']}</td>
                                                    <td>
                                                        {$vo['add_time']|date='Y-m-d H:i:s',###}
                                                    </td>
                                                    <td>
                                                        <if condition="$vo['status'] eq 1">
                                                            <font style='color:green'>开设VIP</font>
                                                            <else/>
                                                            取消VIP
                                                        </if>
                                                        <font style='color:#999'>{$vo['remark']}</font>
                                                    </td>

                                                </tr>
                                            </volist>
                                            <else/>
                                            <tr>
                                                <td colspan="3" align="center">暂无数据!</td>
                                            </tr>
                                        </notempty>

                                        </tbody>
                                    </table>
                                    <table bgcolor="#fff" style="width: 100%;">
                                        <tr>
                                            <td colspan="60%"></td>
                                            <td align="right">
                                                <div class="page_list_ops dataTables_paginate paging_bootstrap pagination" >
                                                    {$_datalist['page_html']}
                                                </div>
                                            </td>
                                        </tr>
                                    </table>

                                </td>
                            </tr>
                        </table>


                    </div><!--/porlets-content-->
                </div><!--/block-web-->
            </div>

        </div>

    </form>



</block>
<block name="script">
    <script>


        $(function() {

            var user_id = $('#user_id').val();

            $.ajax({
                'url': "/indexadmin.php/Payment/search_user",
                'data': {user_id:user_id},
                'dataType': 'json',
                'type': 'POST',
                success: function (data) {
                    if (data.status == 1) {
                        $('#user_info').show();
                        var is_vip = '-';
                        if(data.d==1){
                            is_vip ='是';
                            $("#submit").html('取消VIP');
                            $("#vip").val(0);
                        }else{
                            is_vip ='否';
                            $("#vip").val(1);
                        }
                        $("#nickname").html(data.a);
                        $("#mobile_phone").html(data.b);
                        $("#user_money").html(data.c);
                        $("#is_vip").html(is_vip);

                        $("#mobile").val(data.b);
                        $("#user_name").val(data.e);

                    }

                }, error: function () {
                    /*失败或异常回调*/

                }, complete: function () {

                }
            });


        });



    </script>

</block>
